package pl.ydp.components.mathcell.mathrecognizer.engine.database.modelsets.math_basic.characters
{
	import pl.ydp.components.mathcell.mathrecognizer.characters.Character;
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveType;
	import pl.ydp.components.mathcell.mathrecognizer.model.PrimitivesRelation;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescription;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescriptorType;
	import pl.ydp.components.mathcell.mathrecognizer.model.ShapeModel;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ConnectionsDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.LocationDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ObjectDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.SizeDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.presets.PrimitivePresets;
	
	public class MB_ch_9
	{

		public static const MODELS_COUNT:Number = 1;
		
		//---------------------------------------------------
		
		public static function getModels():Array{
			
			var nineShapeModels:Array = new Array();
			
			nineShapeModels.push(getModel0());
			nineShapeModels.push(getModel1());
			nineShapeModels.push(getModel2());
			nineShapeModels.push(getModel3());			
			
			return nineShapeModels;
		}
		
		//---------------------------------------------------
		
		private static function getModel0():ShapeModel{
			var nine:ShapeModel;
			var name:String = "MB_9_STD";
			var nine_prim:Array = new Array();
			var nine_ref:Array = new Array();
			var nine_rel:Array = new Array();
			
			nine_prim.push(PrimitiveType.LOOP, PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			nine_ref.push(0,1,PrimitivePresets.RLT_FULL);
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 7, ObjectDescriptor.COG, ObjectDescriptor.END_NORTHERN)));
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.BODY, ObjectDescriptor.END_NORTHERN)));
			
			nine_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 3)));
			
			nine = new ShapeModel(Character.NINE, nine_prim, nine_ref, nine_rel, new Array(), name, false);
			
			return nine;				
		}
		
		//---------------------------------------------------
		
		private static function getModel1():ShapeModel{
			var nine:ShapeModel;
			var name:String = "MB_9_RND";
			var nine_prim:Array = new Array();
			var nine_ref:Array = new Array();
			var nine_rel:Array = new Array();
			
			nine_prim.push(PrimitiveType.LOOP, PrimitiveType.CURVE_SE);
			
			nine_ref.push(0,1,PrimitivePresets.RLT_FULL);
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 7, ObjectDescriptor.COG, ObjectDescriptor.END_NORTHERN)));
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.BODY, ObjectDescriptor.END_NORTHERN)));
			
			nine_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 3)));
			
			nine = new ShapeModel(Character.NINE, nine_prim, nine_ref, nine_rel, new Array(), name, false);
			
			return nine;				
		}
		
		//---------------------------------------------------
		
		private static function getModel2():ShapeModel{
			var nine:ShapeModel;
			var name:String = "MB_9_JAPAN";
			var nine_prim:Array = new Array();
			var nine_ref:Array = new Array();
			var nine_rel:Array = new Array();
			
			nine_prim.push(PrimitiveType.LOOP, PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			nine_ref.push(0,1,PrimitivePresets.RLT_FULL);
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 10, ObjectDescriptor.COG, ObjectDescriptor.END_NORTHERN)));
						
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.BODY, ObjectDescriptor.END_NORTHERN)));
			
			nine = new ShapeModel(Character.NINE, nine_prim, nine_ref, nine_rel, new Array(), name, false);
			
			return nine;				
		}
		
		//---------------------------------------------------
		
		private static function getModel3():ShapeModel{
			var nine:ShapeModel;
			var name:String = "MB_9_PLASTIC";
			var nine_prim:Array = new Array();
			var nine_ref:Array = new Array();
			var nine_rel:Array = new Array();
			
			nine_prim.push(PrimitiveType.LOOP, PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.LINE0);
			
			nine_ref.push(0,1,2,PrimitivePresets.RLT_FULL);
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 10, ObjectDescriptor.COG, ObjectDescriptor.END_NORTHERN)));
						
			nine_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.BODY, ObjectDescriptor.END_NORTHERN)));

			nine_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.END_SOUTHERN, ObjectDescriptor.COG)));
						
			nine_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END_SOUTHERN, ObjectDescriptor.END_EASTERN)));
			
			
			
			nine = new ShapeModel(Character.NINE, nine_prim, nine_ref, nine_rel, new Array(), name, false);
			
			return nine;				
		}
		
		//---------------------------------------------------

	}
}